####################################################################
#
# README
# Date: August 2014
#
####################################################################
#
# DESCRIPTION: this README provides instruction to allow 
# replicating the results of MS #15454, "Intermediaries in
# International Trade: Products and Destinations" by Andrew
# B. Bernard, Marco Grazzi and Chiara Tomasi accepted for publication
# in the Review of Economics and Statistics
####################################################################




1. DATA, PROGRAMS AND HARDWARE

Data for the empirical analysis were accessed and are currently
maintained at ISTAT (Istituto Italiano di Statistica) facilities in
Rome. The following five Stata do files allow to replicate the
analysis of the paper and they can be executed on Stata/SE both
versions 13 and 12. Data are loaded from directory
~/work/bergrato_export/. The software was run on a Shuttle P2 3500P,
Q9550 (4x2.83 GHz) Intel CPU, 8 GB DDR2-800 RAM, and with a linux
operating system, gentoo distribution, kernel version 3.1.




generate_countrydata.do
This file generates the country data used in the empirical
analysis. Gross Domestic Product (GDP) and Real Exchange Rate (RER)
have been retrieved from the World Bank database
(http://databank.worldbank.org/data). Geographic distance is taken
from CEPII dataset. Variables used to computed Market Costs and
Governance Indicators are taken from WORLD-BANK DOING BUSINESS (WBDB)
and WORLD BANK GOVERNANCE dataset respectively.


generate_productdata.do
This do-file generates the product data used in the empirical
analysis. In particular, data on relation-specificity are taken from
Nathan Nunn's article "Relationship-Specificity, Incomplete contracts,
and the Pattern of Trade" 2007. Quarterly Journal of Economics, 122
(2): 569-600. Such data are currently available at
http://scholar.harvard.edu/nunn/pages/data-0. Product differentiation
(as proxied by the coefficient of price dispersion) and the per
product cost of entry/exit are computed on Istat firm-product-country
trade data. Policy barriers as proxied by tariff are taken from World
Integrated Trade System (WITS), http://wits.worldbank.org/


table1.do
This do-file defines four broad categories of firms: manufacturers,
wholesalers, retailers, and a residual group including remaining
sectors. It then computes the total value of exports and the relative
share of the four broad categories of firms as reported in Table 1 of
the paper.


table2.do
Provide results of Table 2 of the paper. First, we restrict the focus
to Italian exports outside the EU; second, we generate product-country
total exports by exporter type; third, we merge information on country
and product characteristics (as described in generate_countrydata.do
and generate_productdata.do); fourth, we run the regressions.


table3.do
Provides result of Table 3 of the paper. We start by considering
product-country level of aggregation. First, we generate aggregate
exports by product-country; second we generate the dummy for
product-country with wholesale share greater than the median (mean);
third, we merge other relevant variables and finally, fourth, we run
the regression at the product-country level. The same procedure is
then repeated for country level data.




2. DATA DICTIONARY 

We provide here a data dictionary that defines each variable and gives
the provenance of all the data. The name of the variables is that used
in the paper. In square brackets the names of the variables as used in
the Stata code.

Trade and firm data
----------------------

Firm Identification code [codiceasia]: unique code of the firm

Country Identification code [country]: unique code of the country

Sector Identification code [sector]: unique code of the sector

Product Identification code [hs6 or sh6]: a six digit category in the Harmonized System 

Four broad categories of firms: manufacturers [manuf], wholesalers [whol], retailers [reta], and a residual group including remaining sectors [energy+constr+tcu+fire+nosector]

Export Value at firm-product-country level [export]: export value by the firm for product-country destination pairs

Import Value at firm-product-country level [import]: import value by the firm for product-country destination pairs

Export Unit Value [VMUE]: export unit value for each firm-product-country transaction 


Country data
--------------

GDP (Gross Domestic Product) [gdp]: is the proxy for market size. It is
taken from World Bank World Development Indicators database, constant
2000 US dollars. 

Distance [dist]: we proxy transportation costs by geographic distance
calculated using the great circle formula (de Sousa et al.;
2012). Data are taken from www.cepii.fr/anglaisgraph/bdd/distances.htm

Market Costs [WBDB_extraEU]: this is our proxy for the market-specific
fixed costs of exporting to a country, we use three measures from the
World Bank Doing Business dataset: number of documents for importing,
cost of importing and time to import (Djankov et al.; 2010).  Given
the high correlation between these variables, we use the primary
factor (Market Costs) derived from principal component analysis. Data
are taken from
http://data.worldbank.org/data-catalog/doing-business-database

Governance Indicators [factor1ST_extraEU]: this variable has been
built using the same procedure employed for Market Costs. We
considered six measures: voice and Accountability, Political Stability
and Absence of Violence/Terrorism, Government Effectiveness,
Regulatory Quality, Rule of Law, and Control of Corruption. Data are
taken from
http://data.worldbank.org/data-catalog/doing-business-database

Real Exchange Rate in annual differences [delta_rer]: is computed
using Official exchange rate (LCU per US$, period average) and
Inflation, consumer prices (annual %). Both are taken from
databank.worldbank.org


Product data
--------------

min(entry, exit) [minA]: it is minimum between the rates of entry into
the export a given product and the rate of exit from export of the
same product. It is computed on microdata as detailed in
generate_producdata.do

Coefficient of variation [disp_vmu]: this is our proxy for product
differentiation. It is computed on microdata as detailed in
generate_producdata.do

Relation Specificity [contrac2]: this is variable that we use to quantify the
importance of relationship-specific investment in intermediate inputs
across industries. It is computed starting from Nunn (2007), as
described in generate_producdata.do

Tariff [tariff]: Policy barriers as proxied by tariff are taken from
World Integrated Trade System (WITS), http://wits.worldbank.org/.





3. HOW TO ACCESS THE DATA

Reserchers with an approved project can access the data. In our case,
data have been accessed at the ISTAT facilities in Rome, at the office
located in Via Tuscolana, 1788 00173 Roma. Queries about data access
can be made to the Centro Diffusione Dati (Data Diffusion Centre):

http://www.coeweb.istat.it/english/default2.htm

Once registered on the website, it is possible to electronically
submit queries.




